/*
 * @Author: lujiangbo knight_lujb@163.com
 * @Date: 2024-06-27 19:16:50
 * @LastEditors: lujiangbo knight_lujb@163.com
 * @LastEditTime: 2024-06-27 19:21:38
 * @Description: 
 */
import { defineStore } from "pinia";

export const useCodeFromUrlStore = defineStore({
  id: 'codeFromUrlStore',
  state: () => ({
    code: <string>('')
  }),
  actions: {
    setCode(code: string | undefined) {
      if (!code) return
      this.code = code
    },
    clearCode() {
      this.code = ''
    }
  },
  persist: {
    key: 'piniaCodeFromUrlStoreStore', //存储名称
    storage: sessionStorage, // 存储方式
  }
})